const purl = "https://hospital.xxjwxc.cn/hospitalserver/api/v1/"
// const purl = "http://192.168.0.152:7061/hospitalserver/api/v1/"
// const purl = "http://192.168.0.27:7061/hospitalserver/api/v1/"
const requestdata = (method, data, modul, success, fail, complete, header, dataType, responseType, url) => {
    if (!modul) {
        url = url;
    } else {
        url = purl + modul;
    }
    if (!header) {
        header = { 'Content-Type': 'application/json' }
    } else {
        header = { 'Content-Type': header }
    }
    wx.request({
        url: url,
        data: data,
        method: method,
        success: success,
        fail: fail,
        complete: complete,
        header: header,
        dataType: dataType
    })
}

const fileUpdata = (filePath, filename, modul, success, fail, data, url) => {
    if (!modul) {
        url = url;
    } else {
        url = purl + modul;
    }
    wx.uploadFile({
        url: url,
        filePath: filePath,
        name: filename,
        formData: data,
        success: success,
        fail: fail
    })
}

module.exports = {
    requestdata: requestdata,
    fileUpdata: fileUpdata,
}